set WSL’s default distribution

Got it 👍 — you want to set WSL’s default distribution so that when you type wsl it automatically logs you into Ubuntu. Here’s how to do it:


🐧 Step 1: Check Installed Distros

Open PowerShell or Command Prompt and run:

wsl --list --verbose

This shows all installed distributions and their states. You’ll see names like Ubuntu, Ubuntu-20.04, Ubuntu-22.04.


🐧 Step 2: Set Ubuntu as Default

Run:

wsl --set-default Ubuntu

or, if you installed a specific version:

wsl --set-default Ubuntu-22.04

🐧 Step 3: Verify

Check again with:

wsl --list --verbose

The default distro will be marked with an asterisk *.


🐧 Step 4: Launch

Now, simply typing:

wsl

will drop you directly into Ubuntu.


⚡ Extra tip: If you want to always log in as root or a specific user inside Ubuntu, you can configure it:

wsl -d Ubuntu -u root

Or set the default user inside Ubuntu with:

sudo nano /etc/wsl.conf

Add:

[user]
default=yourusername

Then restart WSL:

wsl --shutdown

Also See

File5FileLast Modified
在WSL 中安裝 Ubuntu在WSL 中安裝 Ubuntu2:25 PM - January 12, 2026
Windows 上透過 WSL 進入 Ubuntu shellWindows 上透過 WSL 進入 Ubuntu shell2:25 PM - January 12, 2026
Restart DockerRestart Docker2:25 PM - January 12, 2026
Force restart WSLForce restart WSL2:25 PM - January 12, 2026
install Ubuntu on WSLinstall Ubuntu on WSL2:34 PM - December 15, 2025